home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Draw / Sources / FloatFrm.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  3.8 KB  |  134 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FloatFrm.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "ODFDraw.hpp"
  13.  
  14. #ifndef FLOATFRM_H
  15. #include "FloatFrm.h"
  16. #endif
  17.  
  18. #ifndef DRAWPART_H
  19. #include "DrawPart.h"
  20. #endif
  21.  
  22. // ----- Part Layer -----
  23.  
  24. #ifndef FWUTIL_H
  25. #include "FWUtil.h"
  26. #endif
  27.  
  28. #ifndef FWCONTXT_H
  29. #include "FWContxt.h"
  30. #endif
  31.  
  32. // ----- OS Layer -----
  33.  
  34. #ifndef FWRECSHP_H
  35. #include "FWRecShp.h"
  36. #endif
  37.  
  38. #ifndef FWWINDOW_H
  39. #include "FWWindow.h"
  40. #endif
  41.  
  42. // ----- Foundation Layer -----
  43.  
  44. #ifndef FWDEBUG_H
  45. #include "FWDebug.h"
  46. #endif
  47.  
  48. //========================================================================================
  49. // Runtime Information
  50. //========================================================================================
  51.  
  52. #ifdef FW_BUILD_MAC
  53. #pragma segment odfdrawframes
  54. #endif
  55.  
  56. //========================================================================================
  57. // CLASS CFloatingWindowFrame
  58. //========================================================================================
  59.  
  60. //----------------------------------------------------------------------------------------
  61. // CFloatingWindowFrame::CFloatingWindowFrame
  62. //----------------------------------------------------------------------------------------
  63.  
  64. CFloatingWindowFrame::CFloatingWindowFrame(Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, CDrawPart *drawPart) :
  65.     FW_CFrame(ev, odFrame, presentation, drawPart),
  66.     fDrawPart(drawPart),
  67.     fFacet(NULL),
  68.     fMapping(FW_kDevice)
  69. {
  70.     SetCanBeActiveFrame(ev, FALSE);
  71. }
  72.  
  73. //----------------------------------------------------------------------------------------
  74. // CFloatingWindowFrame::~CFloatingWindowFrame
  75. //----------------------------------------------------------------------------------------
  76.  
  77. CFloatingWindowFrame::~CFloatingWindowFrame()
  78. {
  79. }
  80.  
  81. //----------------------------------------------------------------------------------------
  82. // CFloatingWindowFrame::EraseBackground
  83. //----------------------------------------------------------------------------------------
  84.  
  85. void CFloatingWindowFrame::EraseBackground(Environment* ev, FW_CGraphicContext& gc)
  86. {    
  87.     FW_CRect rect;
  88.     gc.GetClipRect(rect);
  89.     FW_CInk ink(FW_kRGBLightGray);
  90.     FW_CRectShape::RenderRect(gc, rect, FW_kFill, ink);
  91. }
  92.  
  93. //----------------------------------------------------------------------------------------
  94. // CFloatingWindowFrame::FacetAdded
  95. //----------------------------------------------------------------------------------------
  96.  
  97. void CFloatingWindowFrame::FacetAdded(Environment* ev, ODFacet* facet, unsigned short facetCount)
  98. {
  99.     FW_CFrame::FacetAdded(ev, facet, facetCount);
  100.     
  101.     FW_ASSERT(fFacet == NULL);    // we know we can't have more than one facet
  102.     fFacet = facet;
  103. }
  104.  
  105. //----------------------------------------------------------------------------------------
  106. // CFloatingWindowFrame::FacetRemoved
  107. //----------------------------------------------------------------------------------------
  108.  
  109. void CFloatingWindowFrame::FacetRemoved(Environment* ev, ODFacet* facet, unsigned short facetCount)
  110. {
  111.     FW_ASSERT(facet == fFacet);    // we know we can't have more than one facet
  112.     fFacet = NULL;
  113.  
  114.     // ----- Call inherited -----
  115.     FW_CFrame::FacetRemoved(ev, facet, facetCount);    
  116. }
  117.  
  118. //----------------------------------------------------------------------------------------
  119. // CFloatingWindowFrame::HideShowFloating
  120. //----------------------------------------------------------------------------------------
  121.  
  122. void CFloatingWindowFrame::HideShowFloating(Environment* ev)
  123. {
  124.     FW_CWindow *window = GetWindow(ev);
  125.     
  126.     if (window->IsShown(ev))
  127.         window->Hide(ev);
  128.     else
  129.         window->Show(ev);    
  130. }
  131.  
  132.  
  133.  
  134.